﻿using DeviceCommons.DeviceMessages.Models.V1;
using System.Buffers;

namespace DeviceCommons.DataHandling
{
    /// <summary>
    /// 提供设备消息处理过程中使用的内存池和数组池资源
    /// 用于优化内存分配，减少垃圾回收压力
    /// </summary>
    public class DeviceMessageArrayPool
    {
        internal static readonly string DefaultAedPassword = "MyDeviceCommons";
        /// <summary>共享字节内存池实例</summary>
        internal static readonly MemoryPool<byte> MemoryPool = MemoryPool<byte>.Shared;

        /// <summary>共享字节数组池实例</summary>
        internal static readonly ArrayPool<byte> ByteArrayPool = ArrayPool<byte>.Shared;

        /// <summary>设备消息信息对象数组池</summary>
        internal static readonly ArrayPool<IDeviceMessageInfo> Info_ArrayPool = ArrayPool<IDeviceMessageInfo>.Shared;

        /// <summary>设备消息读数信息对象数组池</summary>
        internal static readonly ArrayPool<IDeviceMessageInfoReading> InfoReading_ArrayPool = ArrayPool<IDeviceMessageInfoReading>.Shared;

        /// <summary>设备消息读数状态对象数组池</summary>
        internal static readonly ArrayPool<IDeviceMessageInfoReadingState> InfoReadingState_ArrayPool = ArrayPool<IDeviceMessageInfoReadingState>.Shared;
    }
}
